import sympy as sp

# 定义符号变量
x = sp.symbols('x')

# 定义函数
f = sp.cos(x)

# 计算泰勒展开式（展开到 x 的 5 次方）
taylor_series = sp.series(f, x, 0, 6)
print("cos(x)的泰勒展开:", taylor_series)